class Memory:
    def __init__(self):
        self.memory = {}
    def writeMemory(self,pc,instruction):
        self.memory[pc] = instruction
    def readMemory(self,pc):
        if (pc in self.memory):
            return self.memory[pc]
        else:
            return 0